package com.youlai.boot.system.converter;

import org.mapstruct.Mapper;
import com.youlai.boot.system.model.entity.WasteType;
import com.youlai.boot.system.model.form.WasteTypeForm;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 垃圾类型管理对象转换器
 *
 * @author youlaitech
 * @since 2025-02-22 16:33
 */
@Mapper(componentModel = "spring")
public interface WasteTypeConverter{

    @Mappings({
            @Mapping(target = "marketPrice", source = "marketPrice"),
            @Mapping(target = "unitPrice", source = "unitPrice"),
            @Mapping(target = "processPrice", source = "processPrice"),
            @Mapping(target = "govSubsidyPrice", source = "govSubsidyPrice"),
            @Mapping(target = "cercSubsidyPrice", source = "cercSubsidyPrice"),
            @Mapping(target = "cerc", source = "cerc"),
            @Mapping(target = "userRatio", source = "userRatio"),
            @Mapping(target = "orgRatio", source = "orgRatio"),
            @Mapping(target = "envRating", source = "envRating"),
            @Mapping(target = "pointsPerKg", source = "pointsPerKg")
    })
    WasteTypeForm toForm(WasteType entity);

    @Mappings({
            @Mapping(target = "marketPrice", source = "marketPrice"),
            @Mapping(target = "unitPrice", source = "unitPrice"),
            @Mapping(target = "processPrice", source = "processPrice"),
            @Mapping(target = "govSubsidyPrice", source = "govSubsidyPrice"),
            @Mapping(target = "cercSubsidyPrice", source = "cercSubsidyPrice"),
            @Mapping(target = "cerc", source = "cerc"),
            @Mapping(target = "userRatio", source = "userRatio"),
            @Mapping(target = "orgRatio", source = "orgRatio"),
            @Mapping(target = "envRating", source = "envRating"),
            @Mapping(target = "pointsPerKg", source = "pointsPerKg")
    })
    WasteType toEntity(WasteTypeForm formData);
}